package com.salon.server.controller;


import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.salon.server.entity.BeauticianSchedule;
import com.salon.server.model.R;
import com.salon.server.model.request.BeauticianScheduleRequest;
import com.salon.server.service.BeauticianScheduleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 美容师排班表 前端控制器
 * </p>
 *
 * @author zooy
 * @since 2025-08-28
 */
@RestController
@RequestMapping("salon/beauticianSchedule")
public class BeauticianScheduleController {

    @Autowired
    private BeauticianScheduleService beauticianScheduleService;

    /**
     * page
     */
    @PostMapping("/page")
    public R page(@RequestBody BeauticianScheduleRequest request) {

        return R.success(beauticianScheduleService.page(request, new LambdaQueryWrapper<BeauticianSchedule>()
                .eq(request.getBeauticianId() != null, BeauticianSchedule::getBeauticianId, request.getBeauticianId())
                .eq(request.getWeekDay() != null, BeauticianSchedule::getWeekDay, request.getWeekDay())
                .eq(request.getStatus() != null, BeauticianSchedule::getStatus, request.getStatus())));
    }

     /**
      * update
      */
     @PostMapping("update")
     public R update(@RequestBody BeauticianSchedule beauticianSchedule) {

         return R.success(beauticianScheduleService.updateById(beauticianSchedule));
     }

}
